<?php 
error_reporting(0);
include_once 'conf/db-config.php';
if(strlen($_SESSION['user_id'])==0)
{
?>
<script type="text/javascript">
	function doLogin()
	{
		var username = $('#txtUserName').val();
		var password = $('#txtUserPassword').val();
		if((username.length !=0) && (password.length!=0))
		{
			$.post("doLogin.php",{username:username,password:password},function(data){
				window.open(data,"_self");
			},"text");
		}
	}
</script>
<form method="post" action="doLogin.php" id="login_form">
			<div class="login">
			<div class="studentlogin">
					<h1>Student Login</h1>
					<div class="username">
						<p class="uname">Username:</p>
						<div class="text_box">
						<input type="text" class="t_box" value="" id="txtUserName" name="txtUserName" tabindex="1"/>
						</div>
					</div>
					<div class="username">
						<p class="uname">Password:</p>
						<div class="text_box">
						<input type="password" class="t_box" value="" id="txtUserPassword" name="txtUserPassword" tabindex="2" />
						</div>
					</div>
					<div class="cssbutton sample a">
					<input type="button" value="Submit" id="btnLogin" name="btnLogin" onclick="doLogin();" tabindex="3">
					</div>
					
				&nbsp;<a href="Registration.php" >Register Here !</a>
				&nbsp;<a href="forgot-password.php" >Forgot Password !</a>
				</div>
				<div class="logo1"><a href="#"><img src="images/logo1.png" alt="" /></a></div>
			</div>
</form>
<?php 
}
else
{
?>
<div class="login">
	<div class="studentlogin"></div>
	<div class="logo1"><a href="#"><img src="images/logo1.png" alt="" /></a></div>
	<div style="text-align:right" >
	<?php if(strlen($_SESSION["u_name"])!= 0)
			{ 
	?>Welcome ,<?php print $_SESSION["u_name"];}?>&nbsp;&nbsp;
	<?php if(strlen($_SESSION["u_name"])!= 0)
			{ 
	?><a href="Logout.php">Log Out</a>
	<?php } ?>
	</div>
</div>
<?php 
}
?>